package com.fqgj.xjd.user.client.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/15
 * Time: 下午2:21
 */
public enum AppCodeEnum {
    SDZZ("SDZZ", "0000001"),
    QSYQ("QSYQ", "0000002"),
    JYD("JYD", "0000002");
    private String category;

    private String code;

    AppCodeEnum(String category, String code) {
        this.category = category;
        this.code = code;
    }

    public String getCategory() {
        return category;
    }

    public AppCodeEnum setCategory(String category) {
        this.category = category;
        return this;
    }

    public String getCode() {
        return code;
    }

    public AppCodeEnum setCode(String code) {
        this.code = code;
        return this;
    }

    public static AppCodeEnum getEnumByCategory(String category) {
        AppCodeEnum platformEnum = null;

        for (AppCodeEnum platformEnum1 : AppCodeEnum.values()) {
            if (platformEnum1.getCategory().equals(category)) {
                platformEnum = platformEnum1;
            }
        }

        return platformEnum;
    }

    public static AppCodeEnum getEnumByDesc(String code) {
        AppCodeEnum platformEnum = null;
        for (AppCodeEnum enumObj : AppCodeEnum.values()) {
            if (enumObj.getCode().equals(code)) {
                platformEnum = enumObj;
                break;
            }
        }
        return platformEnum;
    }
}

